<template>
  <div>
    <div>
      <el-table
        :data="tableData"
        stripe
        style="width: 100%">
        <el-table-column
          type="index"
          label="行号"
          width="50">
        </el-table-column>
        <el-table-column
          prop="fileName"
          label="文件名"
          width="1000">
        </el-table-column>
        <el-table-column
          prop="headRow"
          label="标题所在行">
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          width="120">
          <template slot-scope="scope">
            <el-button
              @click.native.prevent="deleteRow(scope.$index, tableData)"
              type="text"
              size="small">
              查询
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-divider><svg-icon icon-class="dashboard" /></el-divider>
    <br>
    <div>
      <excel-table></excel-table>
    </div>
  </div>
</template>

<script>
import request from '@/utils/request'
import ExcelTable from '@/views/excel/ExcelTable'

export default {
  name: "ExcelList",
  components: {
    ExcelTable
  },
  data() {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }]
    }
  },
  methods: {
    getExcelList() {
      request.get('/gu/excel/getExcelDataBase').then(res => {
        this.tableData = res;
      })
    },
    deleteRow(index, rows) {
      this.$store.commit('SET_EXCELID', rows[index].id)
      console.log(this.$store.state.excel.excelid)
    }
  },

  created() {
    this.getExcelList();
  }
}
</script>

<style scoped>

</style>
